home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Mail / pine3.92 / pico / msspell.h < prev    next >
C/C++ Source or Header  |  1995-10-18  |  7KB  |  200 lines

  1. /**************************************************************************************************
  2.  
  3.     SPELLCHK
  4.     Spelling checker.
  5.  
  6.     Written and copyright by Brian J Quinion 1995.
  7.  
  8.     Version for Microsoft Windows.
  9.     Version:  3.00
  10.     Date:     13 July 1995
  11.     Module:   SPELL.H
  12.  
  13. **************************************************************************************************/
  14.  
  15. //#if !defined(__DIR_H)
  16. //#include <dir.h>
  17. //#endif
  18.  
  19. #if !defined(__WINDOWS_H)
  20. #include <windows.h>
  21. #endif
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {            /* Assume C declarations for C++ */
  25. #endif  /* __cplusplus */
  26.  
  27. /*************************************************************************
  28.  
  29.     There are two ways to access the DLLs.  This first method is the
  30. full interface It is quite complicated but allows full control of the
  31. DLL.  Its design is based on that used for the common dialog boxes.
  32. The functions mentioned are contained in spellch3.dll.
  33.  
  34.     See the developers help file and the example code.
  35.  
  36. ***************************************************************************/
  37.  
  38. #define MAXPATH                   128
  39. #define MAXDICTITLE            20
  40. #define MAXSPELL               255
  41. typedef WORD HUNDO;
  42.  
  43. // Custom dictionaries
  44.     // Structure
  45.     typedef struct
  46.     {
  47.         char            DicFile[MAXPATH];
  48.         char            DicTitle[MAXDICTITLE];
  49.         char            DicLanguage[13];
  50.         BYTE            Options;
  51.             #define CD_READONLY        1
  52.             #define CD_DISABLED        2
  53.             #define CD_CHANGED         4
  54.             #define CD_BYLANGUAGE      8
  55.     // Reserved
  56.         HGLOBAL         hDic;
  57.         LPSTR           lpDic;
  58.         WORD            Size;
  59.     } CUSTDIC, far * LPCUSTDIC;
  60.  
  61.  
  62. // Main options block
  63.     // Structure
  64.     typedef struct
  65.     {
  66.         WORD                wSizeOfBlock;
  67.         HWND                hWndParent,
  68.                             hWndDlg;
  69.         DWORD               CheckWordOptions;
  70.             #define CWO_ALLOWCHANGE            1
  71.             #define CWO_AUTOSUGGEST            2
  72.             #define CWO_SUGGESTCUST            4
  73.             #define CWO_NOOPTIONS              8
  74.             #define CWO_UNDO                   16
  75.             #define CWO_NOHELP                 32
  76.  
  77.             #define CWO_USEMAINHOOK            64
  78.             #define CWO_USEOPTIONSHOOK         128
  79.             #define CWO_USECUSTOMMAINDLG       256
  80.             #define CWO_USECUSTOMOPTIONSDLG    512
  81.             #define CWO_SENDMSGTOMAINHOOK      1024
  82.             #define CWO_SENDMSGTOOPTIONSHOOK   2048
  83.             #define CWO_CHECKMULTIPLE          4096
  84.             #define CWO_DONTUSEFULL            8192
  85.  
  86.             #define CWO_USEASCIIACCENTS        16384
  87.             #define CWO_PUNCTUATIONCANBREAK    (32768L)
  88.             #define CWO_DEBUGLOG               (65536L)
  89.  
  90.         char                szLanguage[13];
  91.         HGLOBAL             hCustomDics;
  92.         BYTE                NumCustom;
  93.         BYTE                CurCustom;
  94.  
  95.         HFILE               hDebugLog;
  96.  
  97.         HINSTANCE           hInstance;
  98.         DLGPROC             fpMainHook;
  99.         DLGPROC             fpOptionsHook;
  100.         LPSTR               lpMainDlg;
  101.         LPSTR               lpOptionsDlg;
  102.  
  103.         DWORD               dwCustData;
  104.         DWORD               dwCustData2;
  105.  
  106.         char                ToCheck[MAXSPELL];
  107.         char                Changed[MAXSPELL];
  108.         BOOL                bCurWordChanged;
  109.  
  110.         char                PrevWord[MAXSPELL];
  111.         WORD                wFunctionType;
  112.             #define WORD_NOTFOUND             1
  113.             #define WORD_REPEATED             2
  114.  
  115.         BYTE                CurPosCheck;
  116.         BYTE                CurPosChanged;
  117.         char                CurWord[MAXSPELL];
  118.  
  119. // All private - will be marked as reserved on final
  120.         HFILE               hDic;
  121.         HGLOBAL             hIndexBlock;
  122.         LPSTR               lpLoadedBlock;
  123.         LPSTR               lpIndexBlock;
  124.         HGLOBAL             hWordsBlock;
  125.         DWORD               dwWordsSize;
  126.         BOOL                bExpandWordsBlock;
  127.         HGLOBAL             hIgnoreAll;
  128.         LPSTR               lpIgnoreAll;
  129.         LPCUSTDIC           lpCustomDics;
  130.     } CHECKWORD, FAR * LPCHECKWORD;
  131.  
  132. WORD WINAPI SPCHK_Version(void);
  133. void WINAPI SPCHK_GetValidLettersBlock(LPSTR);
  134. BOOL WINAPI SPCHK_CheckWord(LPCHECKWORD);
  135. void WINAPI SPCHK_Options(LPCHECKWORD);
  136.     #define SPELL_GETNEXT                (WM_USER+240)
  137.     #define SPELL_WORDNOTFOUND           (WM_USER+241)
  138.     #define SPELL_WORDREPEATED           (WM_USER+251)
  139.     #define SPELL_WORDCHANGED            (WM_USER+242)
  140.     #define SPELL_CANUNDO                (WM_USER+243)
  141.     #define SPELL_STOREUNDO              (WM_USER+244)
  142.         #define UNDO_FAIL           0
  143.         #define UNDO_IGNORE         1
  144.         #define UNDO_IGNOREALL      2
  145.         #define UNDO_CHANGE         3
  146.         #define UNDO_ADD            4
  147.         // >= 4 means an ADD
  148.     #define SPELL_UNDOLAST               (WM_USER+245)
  149.     #define SPELL_GETCUSTOMDEFPATH       (WM_USER+246)
  150.     #define SPELL_LANGUAGECHANGED        (WM_USER+247)
  151.     #define SPELL_HELPMAIN               (WM_USER+248)
  152.     #define SPELL_HELPOPTIONS            (WM_USER+249)
  153.     #define SPELL_HELPEDITDIC            (WM_USER+250)
  154.  
  155. /************************************************************************************************
  156.  
  157.     This second method is far simpler, and simply allow your program to call the existing code
  158.     as if the keyboard hot key had been pressed (in fact exactly the same routines are used).
  159.     The functions mentioned are contained in spelledt.dll. 
  160.  
  161.     See the help file and the exapmle code.
  162.  
  163. ************************************************************************************************/
  164. WORD CALLBACK SPEDT_Version(void);
  165. BOOL CALLBACK SPEDT_CheckEdit(HWND);
  166. BOOL CALLBACK SPEDT_CheckEditCustom(HWND, HINSTANCE, LPSTR, LPSTR);
  167.  
  168. BOOL CALLBACK SPEDT_CheckEditClip(HWND);
  169. WORD CALLBACK SPEDT_CheckClipboard(HWND);
  170.  
  171. WORD CALLBACK SPEDT_CheckGlobal(HWND, HGLOBAL far *, WORD, HWND);
  172. WORD CALLBACK SPEDT_CheckGlobalCustom(HWND, HGLOBAL far *, WORD, HINSTANCE, LPSTR, LPSTR, HWND);
  173.     #define CHECKGLOBAL_UNRECOVERABLEERROR  1
  174.     #define CHECKGLOBAL_FORMATNOTKNOWN      2
  175.     #define CHECKGLOBAL_CHANGED             4
  176.     #define CHECKGLOBAL_FINISHED            8
  177.  
  178. void CALLBACK SPEDT_SetupBox(HWND);
  179. void CALLBACK SPEDT_SetupBoxLimited(HWND);
  180. void CALLBACK SPEDT_SetupCustom(HWND, HINSTANCE, LPSTR);
  181.  
  182. BOOL CALLBACK SPEDT_GetParameter(WORD, LPVOID);
  183. BOOL CALLBACK SPEDT_SetParameter(WORD, LPVOID);
  184.     #define SPEDT_LANGUAGE              1
  185.     #define SPEDT_XPOS                  2
  186.     #define SPEDT_YPOS                  3
  187.     #define SPEDT_STOREWINPOS           4
  188.     #define SPEDT_AUTOSUGGEST           5
  189.     #define SPEDT_SUGGESTFROMCUSTOM     6
  190.     #define SPEDT_ASCIITOANSI           7
  191.     #define SPEDT_IGNORELINES           8
  192.     #define SPEDT_DOAFTER               9
  193.     #define SPEDT_ONPUNCTUATION         10
  194.     #define SPEDT_DEBUG                 11
  195.     #define SPEDT_PROGRESSINDICATOR     12
  196.  
  197. #ifdef __cplusplus
  198. }                       /* End of extern "C" { */
  199. #endif  /* __cplusplus */
  200.